Skip to content

feat: add Netra.redteam.runRedteam() to trigger an existing red-team config - #134

Open
jithin23-kv wants to merge 7 commits into
devfrom
feat/redteam-sdk-client
Open

jithin23-kv wants to merge 7 commits into
devfrom
feat/redteam-sdk-client

Conversation

@jithin23-kv

@jithin23-kv jithin23-kv commented Aug 10, 2026 •

Copy link
Copy Markdown
  • Netra.redteam.runRedteam({configId, handler, maxConcurrency?}) — fetches the run's prompt list once, drives every session's turns locally against a plain handler function, submits results, returns aggregated results/progress/riskScore
  • Depends on the backend PR (KeyValueSoftwareSystems/combat-ai-core#1445) for the /redteam/sdk/* endpoints

104/104 tests passing. Verified against a real running backend + real Postgres (not just mocks) — full multi-turn attack loop, judge scoring, progress/riskScore aggregation.

@jithin23-kv jithin23-kv changed the title feat(redteam): add Netra.redteam.runRedteam() to trigger an existing red-team config feat: add Netra.redteam.runRedteam() to trigger an existing red-team config Aug 10, 2026
AkhileshNair2201 and others added 2 commits August 23, 2026 21:14
* feat: add opt-in TTL caching for getPrompt

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: downgrade vitest for Node 18 and tighten cache tests

Use Vitest 3.x so dev test runs align with engines.node >=18, and add
getPrompt cacheTtl integration coverage plus shutdown re-init behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: add opt-in TTL caching for getPrompt

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: downgrade vitest for Node 18 and tighten cache tests

Use Vitest 3.x so dev test runs align with engines.node >=18, and add
getPrompt cacheTtl integration coverage plus shutdown re-init behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(models): add getModelPricing with opt-in TTL cache

* test(models): cover getModelPricing HTTP client failure paths

Co-authored-by: Cursor <cursoragent@cursor.com>

* NET-1329 simplify cache TTL to module const and per-call override (#112)

* NET-1329 simplify cache TTL to module const and per-call override

Co-authored-by: Cursor <cursoragent@cursor.com>

* test: cover prompt default TTL and drop removed cacheTtlSeconds

Assert PROMPT_CACHE_TTL_SECONDS expiry when cacheTtl is omitted, and stop passing the removed Config option in models client tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: document Models API and expand caching changelog

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
jithin-23 and others added 3 commits August 28, 2026 10:52
…red-team config

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Netra.init() and runRedteam() each installed their own independent
SIGINT/SIGTERM listener; Netra.init()'s process.exit(0) could win the
race and kill the process before runRedteam()'s cancel POST got a
response back from the backend, leaving runs stuck "running"
server-side. Replaces both with a single shared, dependency-free
shutdown-hook registry (src/utils/shutdown-hooks.ts) that installs
the SDK's one real signal listener lazily, on first registration —
so it works for a standalone `new Redteam(config)` instance with no
Netra.init() call too.

Also:
- Adds runNumber to RedteamResult/RunProgress, passed through from
  the backend's new getRunNumber() (matches the dashboard's "Run #N").
- Wraps each redteam turn in its own span and stamps
  netra.trace.origin=redteam on the root span, mirroring the backend's
  existing filter for redteam-originated traces.

Verified live: real SIGINT against a running backend, both via
Netra.init() and via a standalone Redteam instance, each confirmed
server-side (independent of client-side logs) to leave the run
"cancelled" rather than stuck "running".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jithin23-kv
jithin23-kv force-pushed the feat/redteam-sdk-client branch from 563367e to cba71c4 Compare August 28, 2026 05:23
Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/index.ts
Comment thread src/utils/shutdown-hooks.ts Outdated
Comment thread src/api/redteam/api.ts Outdated
jithin23-kv and others added 2 commits August 28, 2026 19:37
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants